﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AMS.DeDuplicator.BusinessLayer
{
    public struct UniquePropertySet
    {
        public readonly string HashValue;
        public readonly long SizeInBytes;

        public UniquePropertySet(string hashValue, long sizeInBytes)
        {
            this.HashValue = hashValue;
            this.SizeInBytes = sizeInBytes;
        }

        public override bool Equals(object obj)
        {
            if (obj == null)
                return false;

            if (obj.GetType() != typeof(UniquePropertySet))
                return false;

            //x.Equals(x) returns true.
            return this == (UniquePropertySet)obj;
        }

        public override int GetHashCode()
        {
            return HashValue.GetHashCode() ^ SizeInBytes.GetHashCode();
        }

        public static bool operator ==(UniquePropertySet a, UniquePropertySet b)
        {
            return a.HashValue == b.HashValue && a.SizeInBytes == b.SizeInBytes;
        }

        public static bool operator !=(UniquePropertySet a, UniquePropertySet b)
        {
            return !(a == b);
        }
    }
}
